package epam.com.study.xml.classes;

import java.io.File;

import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

import org.apache.log4j.Logger;

public class ParserSAX {
	
	private static final Logger log = Logger.getLogger(ParserSAX.class);

	public static ListOfStones loadSAX(String fileName) {
		LoadStonesSAX saxp = null;
		try {
			SAXParserFactory factory = SAXParserFactory.newInstance();
			SAXParser parser = factory.newSAXParser();
			saxp = new LoadStonesSAX();
			parser.parse(new File(fileName), saxp);
		} catch (Exception e) {
			log.error(e.getStackTrace());
		}
		ListOfStones listOfStones = saxp.getResult();
		return listOfStones;
	}
	
}
